#include <iostream>

using namespace std;

int x;
int bit(int x)
{
	int sum = 0;
	while (x)
	{
		sum += x % 10;
		x /= 10;
 	}
	return sum;
}
int main()
{
	cin >> x;
	int ret = 0;
	while (x)
	{
		x -= bit(x);
		ret++;
	}
	cout << ret << endl;
	return 0;
}